#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int peakIndexInMountainArray(vector<int>& arr) {
    int n = arr.size();
    int l = 0, r = arr.size() - 1;
    while (l < r)
    {
        int mid = l + r >> 1;
        if (mid + 1 < n && arr[mid] > arr[mid + 1])
            r = mid;
        else l = mid + 1;
    }
    return l;
}